<link rel="stylesheet" type="text/css" href="<?= base_url(); ?>assets/css/admin/stickytooltip.css" />
<script type="text/javascript" src="<?= base_url(); ?>assets/js/admin/stickytooltip.js"></script>
<script src="<?= base_url(); ?>third_party/ckeditor/ckeditor.js"></script>
<div class="grid_7">
    <div class="box">
        <h2>
            <a href="#" id="toggle-tables">Add News</a>
        </h2>
        <div class="block" >
            <form name="banner" method="POST" action="<?= base_url(); ?>admin/news/submit_news/">
                <fieldset>
                    <legend>Add News : </legend>
                    <div class="field" >
                        <?php if ($this->session->flashdata('message')) { ?>
                            <div id="red"> <?= $this->session->flashdata('message'); ?></div>
                        <?php } ?>
                    </div>
                    <div class="field" style="float:left">
                        <label> Title</label>
                        <input name="title" type ="text" size="42" value="" />
                    </div>
                    <div class="field" style="float:left">
                        <label> Meta Title</label>
                        <input name="meta_title" type ="text" size="125" value="" />
                    </div>
                    <div class="field" style="float:left">
                        <label> Meta Keyword</label>
                        <input name="meta_keyword" type ="text" size="125" value="" />
                    </div>

                    <div class="field" style="float:left">
                        <label> Meta Description</label>
                        <textarea name="meta_description" rows="3" cols="80" ></textarea>
                    </div>
                    <div class="field" style="float:left; width: 99%">
                        <label> Description</label>
                        <textarea id="news_details" name="news_detail"></textarea>
                        <script type="text/javascript">
                            CKEDITOR.replace( 'news_details',
                            {
                                skin : 'v2',
                                enterMode : CKEDITOR.ENTER_BR,
                                toolbar :
                                    [
                                    [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                    [ 'UIColor' ]
                                ]

                            });
                        </script>
                    </div> 
                    <div class="clearfix"></div>
                    </br>
                    <div class="field" style="float:left">
                        <input type="submit" value="Add News" name="insert_news"/>
                    </div>
                </fieldset>
            </form>
        </div>
    </div> <!-- END OF BOX -->
</div>
<div class="grid_7">
    <div class="box">
        <h2>
            <a href="#" id="toggle-tables">News Management</a>
        </h2>
        <fieldset> 
            <legend>News List</legend>
            <div style="margin-bottom: 10px">
                <span style=" float: left; width:110px" ><strong>Posted On</strong></span>
                <span style=" float: left; width:550px"><strong>Title </strong></span>
                <span style="width:10px"><strong></strong></span>
            </div>
            <?php foreach ($news as $news) : ?>
                <div style="display: inline-block;border-bottom: 1px #DDD dashed ">
                    <span style="float: left; width:110px" ><?= substr($news->date, 0, 12); ?></span>
                    <span style="float: left; width:575px"><?= substr($news->title, 0, 75); ?> 
                        <span id="mystickytooltip" class="stickytooltip">
                            <a href="#"><img src="<?= base_url(); ?>assets/images/sicon.png" alt="Comment" border="0" 
                                             ONMOUSEOVER="ddrivetip('Title:<?= $news->title; ?>')" ONMOUSEOUT="hideddrivetip()"/></a>
                        </span>
                    </span>
                    <div style="float:right;">
                        <a href="<?= base_url(); ?>admin/news/edit_news/<?= $news->id; ?>" class="link-button" onclick="return confirm('Are you sure you want to Edit?')">Edit </a></span> 
                        <a href="<?= base_url(); ?>admin/news/delete_news/<?= $news->id; ?>/<?= $news->status; ?>" class="link-button" onclick="return confirm('Are you sure you want to Delete?')">Delete </a></span> 
                    </div>
                </div>

            <?php endforeach; ?>
        </fieldset>    
        <div class="pagination" align="left"> <?php echo $this->pagination->create_links(); ?>  </div>
    </div>
</div>